<?php
declare (strict_types=1);

namespace app\exam\service\admin;

use app\exam\logic\admin\PaperTopicLink;
use eduline\admin\libs\pagelist\ListItem;
use eduline\admin\page\PageList;
use think\annotation\Inject;

/**
 * Class QuestionTopicLinks
 *
 * @package app\exam\service\admin
 */
class QuestionTopicLinks
{
    /**
     * @Inject()
     *
     * @var PaperTopicLink
     */
    protected $paperTopicLink;

    public function linkPaperList(int $topicId)
    {
        $data = $this->paperTopicLink->getQuestionTopicLinkPapers($topicId);
        // 定义字段
        $keyList = [
            'paper_title' => ListItem::make()->title('试卷名称'),
            'update_time' => ListItem::make()->title('更新时间')
        ];

        // 设置表单
        $list = new PageList();
        // 表单字段
        $list->pageKey = $keyList;
        $list->datas   = $data;

        return $list->send();
    }
}